using System;
using System.Data.Entity;

namespace Caramel.EntityFramework
{
	public class EntityFrameworkUnitOfWorkFactory : IUnitOfWorkFactory
	{
		public EntityFrameworkUnitOfWorkFactory(DbContext context)
		{
			this.Context = context;
		}

		public DbContext Context
		{
			get; private set;
		}

		#region IUnitOfWorkFactory Members

		public IUnitOfWork Create(string name)
		{
			return new EntityFrameworkUnitOfWork(this.Context, name);
		}

		public IUnitOfWork CreateReadOnly(string name)
		{
			return new EntityFrameworkUnitOfWork(this.Context, name);
		}

		#endregion
	}
}
